home *** CD-ROM | disk | FTP | other *** search
- property pDid25, pDid35, pDid45, sTime, pDoneLevel, pNextSurvivalTime, pSurvivalCarAdded, pLastSurvivalTime, pGameOverTime, pCarsPlayed
- global UsedCars, RemoveCars, UnUsedCars, gWantToAddNow, CarsInLine, gWaitPoints, gCarList, gPaused, gLevel, gDoingTutorial, gSurvivalLives, gTimePlayed
-
- on beginSprite me
- sTime = the milliSeconds
- pDid25 = 0
- pDid35 = 0
- pDid45 = 0
- pDoneLevel = 0
- pNextSurvivalTime = 1
- pSurvivalCarAdded = 0
- pLastSurvivalTime = 0
- pGameOverTime = 0
- pCarsPlayed = 0
- end
-
- on prepareFrame me
- if gPaused then
- return
- end if
- if (the milliSeconds - sTime) > 1000 then
- AddSecond()
- sTime = the milliSeconds
- if gLevel = 42 then
- if GetTime() = 150 then
- sprite(107).visible = 1
- else
- if GetTime() = 300 then
- sprite(105).visible = 1
- sprite(34).visible = 1
- end if
- end if
- end if
- end if
- if gLevel < 42 then
- UpdateRegularGame()
- else
- UpdateSurvivalGame()
- end if
- sendSprite(3, #update)
- sendSprite(4, #update)
- sendSprite(6, #update)
- sendSprite(5, #update)
- sendSprite(110, #update)
- if (gLevel > 30) and (gLevel < 42) then
- sendSprite(115, #update)
- end if
- if sprite(675).visible then
- sendSprite(675, #update)
- end if
- g = UsedCars.count
- repeat with b = 1 to g
- sendSprite(UsedCars[b], #update)
- end repeat
- g = RemoveCars.count
- repeat with b = 1 to g
- deleteOne(UsedCars, RemoveCars[b])
- end repeat
- RemoveCars = []
- end
-
- on exitFrame me
- global gScore, gLevel
- if (pDoneLevel = 1) and (GetTime() >= pGameOverTime) then
- if gLevel > 0 then
- CheckHighScore(gLevel, gScore)
- else
- sleep(2)
- end if
- go("Over")
- else
- go(the frame)
- end if
- end
-
- on UpdateRegularGame me
- c = gCarList.count
- repeat with b = 1 to c
- if gCarList[b].inPlay = 0 then
- if (gTimePlayed >= gCarList[b].time) and (gWaitPoints.count > CarsInLine.count) then
- if gDoingTutorial and (b = 1) then
- sendSprite(836, #show, 2)
- end if
- pCarsPlayed = pCarsPlayed + 1
- sendSprite(701, #update, gCarList.count, pCarsPlayed)
- gCarList[b].inPlay = 1
- numpeeps = gCarList[b].number
- cols = []
- repeat with h = 1 to numpeeps
- if gCarList[b].color.char[h] = "R" then
- append(cols, 1)
- next repeat
- end if
- if gCarList[b].color.char[h] = "B" then
- append(cols, 2)
- next repeat
- end if
- if gCarList[b].color.char[h] = "G" then
- append(cols, 3)
- next repeat
- end if
- if gCarList[b].color.char[h] = "Y" then
- append(cols, 4)
- next repeat
- end if
- if gCarList[b].color.char[h] = "P" then
- append(cols, 5)
- end if
- end repeat
- carType = 0
- if gCarList[b].type = "Girl" then
- carType = 1
- else
- if gCarList[b].type = "Senior" then
- carType = 2
- else
- if gCarList[b].type = "Man" then
- carType = 3
- else
- if gCarList[b].type = "Woman" then
- carType = 4
- else
- if gCarList[b].type = "Boy" then
- carType = 5
- end if
- end if
- end if
- end if
- end if
- if numpeeps <= 2 then
- carSize = 1
- else
- if numpeeps <= 4 then
- carSize = 2
- else
- carSize = 3
- end if
- end if
- sendSprite(UnUsedCars[1], #GetInLine, numpeeps, carType, cols, carSize)
- exit repeat
- end if
- end if
- end repeat
- if (CarsInLine.count = 0) and (gCarList[gCarList.count].inPlay = 1) then
- pDoneLevel = 1
- repeat with b = 15 to 18
- dl = sendSprite(b, #GetEmpty)
- if dl = 0 then
- pDoneLevel = 0
- exit repeat
- end if
- end repeat
- if pDoneLevel = 1 then
- stuff = sendSprite(110, #GarbageCheck)
- if (stuff[1] = "trash") or (stuff[2] = "trash") then
- pDoneLevel = 0
- end if
- end if
- if pDoneLevel then
- if pGameOverTime = 0 then
- pGameOverTime = GetTime() + 2
- end if
- end if
- end if
- end
-
- on UpdateSurvivalGame me
- if GetTime() = pNextSurvivalTime then
- t = GetTime()
- adj = 15 - (t / 60)
- if adj < 5 then
- adj = 5
- end if
- pNextSurvivalTime = pNextSurvivalTime + adj
- if t < 90 then
- peepList = [2]
- else
- if t < 180 then
- peepList = [2, 1]
- else
- if t < 270 then
- peepList = [2, 1, 3]
- else
- if t < 360 then
- peepList = [2, 1, 3, 5]
- else
- peepList = [2, 1, 3, 4, 5]
- end if
- end if
- end if
- end if
- numpeeps = random(6)
- cols = []
- repeat with b = 1 to numpeeps
- c = random(5)
- append(cols, c)
- end repeat
- r = random(peepList.count)
- carType = peepList[r]
- if numpeeps <= 2 then
- carSize = 1
- else
- if numpeeps <= 4 then
- carSize = 2
- else
- carSize = 3
- end if
- end if
- if gWaitPoints.count > CarsInLine.count then
- sendSprite(UnUsedCars[1], #GetInLine, numpeeps, carType, cols, carSize)
- end if
- end if
- if gSurvivalLives = 0 then
- pGameOverTime = GetTime()
- pDoneLevel = 1
- end if
- end
-